home *** CD-ROM | disk | FTP | other *** search
/ ADA Programming Guide / ADA Programming Guide.iso / ada_gnu / adainc / s-finimp.ads < prev    next >
Text File  |  1996-01-30  |  3KB  |  72 lines

  1. ------------------------------------------------------------------------------
  2. --                                                                          --
  3. --                         GNAT COMPILER COMPONENTS                         --
  4. --                                                                          --
  5. --    S Y S T E M . F I N A L I Z A T I O N _ I M P L E M E N T A T I O N   --
  6. --                                                                          --
  7. --                                 S p e c                                  --
  8. --                                                                          --
  9. --                            $Revision: 1.16 $                              --
  10. --                                                                          --
  11. --           Copyright (c) 1992,1993,1994 NYU, All Rights Reserved          --
  12. --                                                                          --
  13. -- The GNAT library is free software; you can redistribute it and/or modify --
  14. -- it under terms of the GNU Library General Public License as published by --
  15. -- the Free Software  Foundation; either version 2, or (at your option) any --
  16. -- later version.  The GNAT library is distributed in the hope that it will --
  17. -- be useful, but WITHOUT ANY WARRANTY;  without even  the implied warranty --
  18. -- of MERCHANTABILITY  or  FITNESS FOR  A PARTICULAR PURPOSE.  See the  GNU --
  19. -- Library  General  Public  License for  more  details.  You  should  have --
  20. -- received  a copy of the GNU  Library  General Public License  along with --
  21. -- the GNAT library;  see the file  COPYING.LIB.  If not, write to the Free --
  22. -- Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.        --
  23. --                                                                          --
  24. ------------------------------------------------------------------------------
  25.  
  26. --  ??? this package should be a private package. It is set as public for now
  27. --  in order to simplify testing
  28.  
  29. package System.Finalization_Implementation is
  30. pragma Preelaborate (Finalization_Implementation);
  31.  
  32.    type Root;
  33.  
  34.    subtype Finalizable     is            Root'Class;
  35.    type    Finalizable_Ptr is access all Root'Class;
  36.  
  37.    type Root is abstract tagged record
  38.       Prev : Finalizable_Ptr;
  39.       Next : Finalizable_Ptr;
  40.    end record;
  41.  
  42.    procedure Initialize (Object : in out Root) is abstract;
  43.    procedure Finalize   (Object : in out Root) is abstract;
  44.  
  45.  
  46.    -------------------------------------------------
  47.    --  Finalization Management Abstract Interface --
  48.    -------------------------------------------------
  49.  
  50.    Global_Final_List : Finalizable_Ptr;
  51.    --  This list stores the controlled objects defined in library-level
  52.    --  packages. They will be finalized after the main program completion.
  53.  
  54.    procedure Finalize_Global_List;
  55.    --  The procedure to be called in order to finalize the global list;
  56.  
  57.    procedure Attach_To_Final_List
  58.     (L   : in out Finalizable_Ptr;
  59.      Obj : in out Finalizable);
  60.    --  Put the finalizable object on a list of finalizable elements. This
  61.    --  procedure is called during the initialization of the controlled object.
  62.  
  63.    procedure Finalize_List (L : Finalizable_Ptr);
  64.    --  Call Finalize on each element of the list L;
  65.  
  66.    procedure Finalize_One
  67.     (From : in out Finalizable_Ptr;
  68.      Obj  : in out Finalizable);
  69.    --  Call Finalize on Obj and remove it from the list From.
  70.  
  71. end System.Finalization_Implementation;
  72.